# Maintainer: Natanael Copa <ncopa@alpinelinux.org>
pkgname=libdrm
pkgver=2.4.102
pkgrel=0
pkgdesc="Userspace interface to kernel DRM services"
url="https://dri.freedesktop.org/"
arch="all"
# Requires a computer with gfx, no X running, build user in 'video' group..
options="!check"
license="MIT"
depends_dev="linux-headers"
makedepends="$depends_dev meson libpthread-stubs eudev-dev libpciaccess-dev xmlto"
checkdepends="cunit-dev bash"
subpackages="$pkgname-dev $pkgname-doc"
source="https://gitlab.freedesktop.org/mesa/drm/-/archive/libdrm-$pkgver/drm-libdrm-$pkgver.tar.gz"
builddir="$srcdir/drm-libdrm-$pkgver"

build() {
	mkdir -p "$builddir"/builddir
	cd "$builddir"/builddir
	meson \
		-Dprefix=/usr \
		--buildtype=plain \
		-Dfreedreno=true \
		-Dtegra=true \
		-Detnaviv=true \
		-Dudev=true
	ninja
}

check() {
	cd "$builddir"/builddir
	meson test
}

package() {
	cd "$builddir"/builddir
	DESTDIR="$pkgdir" ninja install
}

sha512sums="7d66d7cc6c2534c9ccacf79d950f6988eb729b494abc3be0d5e5e3b75cdbb370b6de88720a9703c04f9db3387cc218972071ae34e672df459b8206a93a7ecfa6  drm-libdrm-2.4.102.tar.gz"
